let TOKEN = 'access_token';
let USERINFO = 'userInfo';

export function saveToken(token) {
  localStorage.setItem(TOKEN, JSON.stringify(token));
}
export function getToken() {
  let token = localStorage.getItem(TOKEN);
  return JSON.parse(token);
}
export function deleteToken() {
  localStorage.removeItem(TOKEN)
}

export function saveUserInfo(userinfo) {
  localStorage.setItem(USERINFO, JSON.stringify(userinfo));
}
export function getUserInfo() {
  let userinfo = localStorage.getItem(USERINFO);
  return JSON.parse(userinfo);
}
export function deleteUserInfo() {
  localStorage.removeItem(USERINFO)
}